package com.ruoyi.web.controller.business;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.request.AskLogRequest;
import com.ruoyi.system.domain.request.CaseRequest;
import com.ruoyi.system.domain.vo.BAskLogVo;
import com.ruoyi.system.domain.vo.BCaseVo;
import com.ruoyi.system.service.BAskLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 问答管理
 * @author yangxz
 **/
@RestController
@RequestMapping("/business/ask")
public class AskController extends BaseController {

    @Autowired
    BAskLogService askLogService;

    /**
     * 获取案例列表
     */
    @PreAuthorize("@ss.hasPermi('dict:ask:list')")
    @GetMapping("/list")
    public TableDataInfo list(AskLogRequest request)
    {
        startPage();
        List<BAskLogVo> list = askLogService.queryList(request);
        return getDataTable(list);
    }

    /**
     * 根据问答日记Id获取详细信息
     */
    @PreAuthorize("@ss.hasPermi('dict:ask:query')")
    @GetMapping(value = "/{askId}")
    public AjaxResult getInfo(@PathVariable Long askId) {
        BAskLogVo askLogVo = askLogService.selectAskLogById(askId);
        return success(askLogVo);
    }
}
